home *** CD-ROM | disk | FTP | other *** search
- /* Listing 16.29 Plastic surface shader using a texture map*/
- /*
- * txtplastic(): version of plastic() shader using an optional texture map
- */
- surface
- RCTxtPlastic(
- float Ks = .5,
- Kd = .5,
- Ka = 1,
- roughness = .1;
- color specularcolor = 1;
- string mapname = "")
- {
- point Nf = faceforward( N, I );
-
- if( mapname != "" )
- Ci = color texture( mapname ); /* Use s and t */
- else
- Ci = Cs;
- Oi = Os;
- Ci = Os * ( Ci *
- (Ka*ambient() + Kd*diffuse(Nf))
- + specularcolor * Ks * specular(Nf,-I,roughness) );
- }
-
-